//店面管理-店面列表
App.util.ns('Admin.Storefront.Storefront');
App.pages.add((function(){
    var NS = Admin.Storefront.Storefront;
    var page = new App.Page({
        name: 'storefront/storefront/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-gg"></i>',
            content: '店面管理'
        }, {
            content: '店面列表'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/storefront/storefront',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'timeRange'},
                {type: 'select', name: 'status', title: '状态', width: '120px', items: [
                    [1, '上线'],
                    [2, '下线']
                ]}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.storefront.storefront.create'},
                {parent: 'view', permission: 'op:admin.storefront.storefront.detail'},
                {parent: 'edit', permission: 'op:admin.storefront.storefront.update'},
                {parent: 'drop', permission: 'op:admin.storefront.storefront.delete'},
                {type: 'inline', permission: 'op:admin.storefront.storefront.online', name: '上线', operation: {type: 'change', url: 'online'}, conditions: [['status', '2']]},
                {type: 'inline', permission: 'op:admin.storefront.storefront.offline', name: '下线', operation: {type: 'change', url: 'offline'}, conditions: [['status', '1']]},
                {type: 'multi', name: '状态', openable: true, items: [
                    {type: 'multi', permission: 'op:admin.storefront.storefront.multiOnline', name: '上线', operation: {type: 'change', url: 'multiOnline', confirm: true}},
                    {type: 'multi', permission: 'op:admin.storefront.storefront.multiOffline', name: '下线', operation: {type: 'change', url: 'multiOffline', confirm: true}}
                ], permission:[
                    'op:admin.storefront.storefront.multiOnline',
                    'op:admin.storefront.storefront.multiOffline'
                ]},
                {parent: 'multiDrop', permission: 'op:admin.storefront.storefront.multiDelete'},
                {parent: 'oplog', permission: 'op:admin.storefront.storefront.getOpLogs'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form)
                }
            }
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());